
<script type="text/javascript">
$(document).ready(function() {

	<?if ( count($this->images) > 0 ):?>
	$('a[id^=delete_]').click(function() 
	{
		var ids = $(this).attr('id').split('_');
		$('#mediaValue').val(ids[1])
		$('#dialog').dialog('open');

	});
	$("#dialogImagen").dialog({
		bgiframe: true,
		autoOpen: false,
		width : 200,
		modal: true,
		title : 'Vista Previa',
	});	
	
	
	$(".fancy").fancybox({
		'titleShow'		: false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic'
		});	
	  
	<?endif;?>
	$("#dialog").dialog({
		bgiframe: true,
		autoOpen: false,
		width: 300,
		modal: true,
		title : 'Eliminar imagen',
		buttons: {
			'Enviar': function() {
					
					window.location = "/admin/media/delete/file/"+$('#mediaValue').val();
				},
			'Cerrar': function() {
				$(this).dialog('close');
			}
		},	
	
	});
});	

</script>
<input type="hidden" id="mediaValue" value="" >
<div id="dialogImagen">
</div>
<div id="dialog">
	<br/><br/>
	<p>Est&aacute; seguro que desea eliminar la imagen?</p>
</div>
                <!-- h2 stays for breadcrumbs -->
                <h2><a href="#">Multimedia</a> &raquo; <a href="#" class="active">Listar im&aacute;genes</a></h2>
                
<div id="main">
	<div id="buttonAdd"><a href="/admin/media/newmedia"><img style="vertical-align : middle;" src="/images/icons/add.png" />&nbsp;Nueva imagen</a></div>
    	<div id="imagesContainer">
          <?foreach( $this->images as $u ):?>
      		<div class="imgContainer">
            	<a href="/upload/multimedia/<?=$u['file']?>" class="fancy"><img title="<?=$u['name']?>" alt="<?=$u['name']?>" src="/upload/multimedia/<?=$u['file']?>" width="120" class="imgThumb" /></a>
                <div class="imgButtons">
					<a title="Editar imagen" href="/admin/media/editmedia/file/<?=$u['id'] ?>" class="edit"><img src="/images/icons/pencil.png" style="vertical-align : middle;" alt="edit"  border=0 /></a>
                	<a title="Eliminar imagen" id="delete_<?=$u['id'] ?>" href="#"> <img style="vertical-align : middle;" src="/images/icons/delete.png" alt="remove"  border=0 /></a>
                </div>
            </div>
          <?endforeach?>	
    	</div>
</div>
<div class="clear"></div>
